x86: correct vCPU dirty CPU handling
authorJan Beulich <jbeulich@suse.com>
Tue, 22 May 2018 14:00:32 +0000 (16:00 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 22 May 2018 14:00:32 +0000 (16:00 +0200)
commit607ce6507dbb936048a702bd930a39ed6bb8ae1a
tree22e5a87c7be05e4d278de1928e1024df18815bf1
parentebdead29672d68fb3f44c2074f05cc0d72ffa83f
x86: correct vCPU dirty CPU handling

Commit df8234fd2c ("replace vCPU's dirty CPU mask by numeric ID") was
too lax in two respects: First of all it didn't consider the case of a
vCPU not having a valid dirty CPU in the descriptor table TLB flush
case. This is the issue Manual has run into with NetBSD.

Additionally reads of ->dirty_cpu for other than the current vCPU are at
risk of racing with scheduler actions, i.e. single atomic reads need to
be used there. Obviously the non-init write sites then better also use
atomic writes.

Having to touch the descriptor table TLB flush code here anyway, take
the opportunity and switch it to be at most one flush_tlb_mask()
invocation.

Reported-by: Manuel Bouyer <bouyer@antioche.eu.org>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
xen/arch/x86/domain.c
xen/arch/x86/mm.c
xen/include/xen/sched.h